import z from "zod";
import i18n from "@/i18n";

export const LoginSchema = () =>
  z.object({
    email: z
      .email({
        message: i18n.t("Invalid email", { defaultValue: "Invalid email" }),
      })
      .min(1, {
        message: i18n.t("Password is required", {
          defaultValue: "Password is required",
        }),
      }),
    password: z.string().min(1, {
      message: i18n.t("Password is required", {
        defaultValue: "Password is required",
      }),
    }),
    captcha: z.string().min(1, {
      message: i18n.t("Captcha is required", {
        defaultValue: "Captcha is required",
      }),
    }),
    captcha_id: z.string().min(1, {
      message: i18n.t("Captcha ID is required", {
        defaultValue: "Captcha ID is required",
      }),
    }),
    remember_me: z.boolean(),
    service: z.string(),
  });

export type LoginFormData = z.infer<ReturnType<typeof LoginSchema>>;
